package com.hr.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hr.mapper.AoaPositionMapper;
import com.hr.entity.AoaPosition;
import com.hr.service.AoaPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * (AoaPosition)表服务实现类
 *
 * @author makejava
 * @since 2022-06-21 20:29:11
 */
@Service("aoaPositionService")
public class AoaPositionServiceImpl extends ServiceImpl<AoaPositionMapper, AoaPosition> implements AoaPositionService {

    @Autowired
    private AoaPositionMapper aoaPositionMapper;

    /**
     * 查询职位列表
     * @return
     */
    @Override
    public List<AoaPosition> queryList() {
        return aoaPositionMapper.selectList(new QueryWrapper<AoaPosition>());
    }

    /**
     *保存或修改
     * @param aoaPosition
     * @return
     */
    @Override
    public boolean save(
            @RequestBody AoaPosition aoaPosition) {
        int row = 0;
        if(aoaPosition.getPositionId()==null){
             row=aoaPositionMapper.insert(aoaPosition);
        }else{
            row=aoaPositionMapper.updateById(aoaPosition);
        }
        return row > 0;
    }

    /**
     * 单值查询
     * @param id
     * @return
     */
    @Override
    public AoaPosition queryByID(Integer id) {
        return aoaPositionMapper.selectById(id);
    }
}

